
/*
 * GET home page.
 */
require('./../common');

exports.load = function(req, res){
  var id = req.params.formID;
  var output =  '<option value="null">--Select--</option>';
  var strSQL = "SELECT * FROM tblworkspace where ID = " +id+ "";
  conn.query(strSQL, function(err, results, fields){
    if(err) throw err;
	
	 for (var index in results) {
			if(results[index].buttons!=undefined){
				buttons = results[index].buttons.split(",");
				for(a=0;a<buttons.length;a++){
				  if(buttons[a]!=""){
					output += '<option id="button_'+a+'" rel="'+a+'" value="'+buttons[a]+'">'+buttons[a]+'</option>'; 
				  }
				}
			}
    }
    res.writeHead(200, {'Content-Type': 'text/html'});
    res.end(output);
  });
};

